package com.mianshi;

/**
 * Created by xi on 2018/11/30.
 */
public class SwitchTest {

    public static int fun(int i){
       int result = 0;
       switch (i){
           case 1:
                result = result +i;
               System.out.println("1111");
               /*
                * 注意：此处如果没有添加break，则代码会继续执行，即使不满足case条件也会执行，直到遇到break
                * 也就时候面的case 2, case 3都会执行
                */
           case 2:
               result = result + i *2;
               System.out.println("2222");
           case 3:
               result = result + i * 3;
               System.out.println("3333");
       }
       System.out.println("result:"+result);
       return result;
    }

    public static void main(String[] args){
        fun(1);
        String s ="23";
        byte a = 1;
        short b = 2;
        char c = 3;
        long d = 2;
        //switch 语法不能是long
        switch (s){

        }

    }
}
